package yunplus.io.hchome.model.api.implement;

import android.support.annotation.NonNull;

import com.alibaba.fastjson.JSONObject;

import yunplus.io.hchome.model.api.contract.IWSInput;

/**
 * Created by WangFan on 2017/1/9.
 */

public class FPMWSInput extends FPMInput implements IWSInput {

    private int _id;
    private static volatile Integer COUNTER = 1000;

    public FPMWSInput(@NonNull int code, @NonNull String user, @NonNull JSONObject args){
        super(code, user, args);
        _id = COUNTER++;
    }

    public FPMWSInput(@NonNull int code, @NonNull String user){
        super(code, user);
        _id = COUNTER++;
    }

    @Override
    public int getId() {
        return _id;
    }

    @Override
    public String toJson() {
        super.toJson();
        this.put("id", getId());
        return this.toJSONString();
    }
}
